<?php

namespace app\admin\controller;

use \think\facade\Request;
use \think\facade\View;
use think\facade\Db;


class Config extends Base
{
    public function base(Request $request)
    {
        $config = getConfig('base');
        // dd($config);
        View::assign("key", "base");
        View::assign("data", $config);
        return View::fetch('Config/base');
    }

    //微信支付
    public function weixinpay(Request $request)
    {
        $config = getConfig('weixinpay');
        View::assign("key", "weixinpay");
        View::assign("data", $config);
        return View::fetch('Config/weixinpay');
    }

    //支付宝支付
    public function zfbpay(Request $request)
    {
        $config = getConfig('zfbpay');
        View::assign("key", "zfbpay");
        View::assign("data", $config);
        return View::fetch('Config/zfbpay');
    }

    //签到设置
    public function sign(Request $request){
        $config = getConfig('sign');

        View::assign("key","sign");
        View::assign("data",$config);
        return View::fetch('Config/sign');
    }

    //上传设置
    public function uploads(Request $request){
        $config = getConfig('uploads');
        View::assign("key","uploads");
        View::assign("data",$config);
        return View::fetch('Config/uploads');
    }

    //修改
    public function update()
    {
        $data = input("post.");
        $data['update_time'] = time();
        $result = setConfig($data['key'], $data);
        if ($result) {
            return $this->renderSuccess('修改成功');
        } else {
            return $this->renderError('修改失败');
        }
    }


}

?>